﻿using LimaLims.Application.Service.Base.Dto;
using LimaLims.Application.Service.Equipment.Dto;
using LimaLims.Core;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LimaLims.Application.Service.Basic.Dto
{
    /// <summary>
    /// 产品分类DTO
    /// </summary>
    public class AddProductCategoryInput : BaseDto
    {
        /// <summary>
        /// 分类名称
        /// </summary>
        public string Name { get; set; }
        
        /// <summary>
        /// 所属父类Id
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 父Ids
        /// </summary>
        public string Pids { get; set; }

        /// <summary>
        /// 打印模板
        /// </summary>
        public long? PrintTemplateId { get; set; }
    }

    public class EditProductCategoryInput : AddProductCategoryInput
    {

    }

    public class ProductCategoryOutput : ITreeNode
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 打印模板ID
        /// </summary>
        public long? PrintTemplateId { get; set; }

        /// <summary>
        /// 模板名称
        /// </summary>
        public string PrintTemplateName { get; set; }

        /// <summary>
        /// 所属父类Id
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 父Ids
        /// </summary>
        public string Pids { get; set; }

        /// <summary>
        /// 子节点
        /// </summary>
        public List<ProductCategoryOutput> Children { get; set; } = new List<ProductCategoryOutput>();

        /// <summary>
        /// 获取节点id
        /// </summary>
        /// <returns></returns>
        public long GetId()
        {
            return Id;
        }

        /// <summary>
        /// 获取节点父id
        /// </summary>
        /// <returns></returns>
        public long GetPid()
        {
            return ParentId;
        }

        /// <summary>
        /// 设置Children
        /// </summary>
        /// <param name="children"></param>
        public void SetChildren(IList children)
        {
            Children = (List<ProductCategoryOutput>)children;
        }
    }

    public class ProductCategoryListOutput : ITreeNode
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 打印模板ID
        /// </summary>
        public long? PrintTemplateId { get; set; }

        /// <summary>
        /// 模板名称
        /// </summary>
        public string PrintTemplateName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedTime { get; set; }

        /// <summary>
        /// 创建者Id
        /// </summary>
        public long? CreatedUserId { get; set; }

        /// <summary>
        /// 创建者名称
        /// </summary>
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 修改者Id
        /// </summary>
        public long? UpdatedUserId { get; set; }

        /// <summary>
        /// 修改者名称
        /// </summary>
        public string UpdatedUserName { get; set; }

        /// <summary>
        /// 有效性
        /// </summary>
        public bool ValidStatus { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 所属父类Id
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 父Ids
        /// </summary>
        public string Pids { get; set; }

        /// <summary>
        /// 子节点
        /// </summary>
        public List<ProductCategoryListOutput> Children { get; set; } = new List<ProductCategoryListOutput>();

        /// <summary>
        /// 获取节点id
        /// </summary>
        /// <returns></returns>
        public long GetId()
        {
            return Id;
        }

        /// <summary>
        /// 获取节点父id
        /// </summary>
        /// <returns></returns>
        public long GetPid()
        {
            return ParentId;
        }

        /// <summary>
        /// 设置Children
        /// </summary>
        /// <param name="children"></param>
        public void SetChildren(IList children)
        {
            Children = (List<ProductCategoryListOutput>)children;
        }
    }
}
